package com.gzl.controller;

import com.gzl.config.MqttSendClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/***************************************************************************
 * <pre></pre>
 * @文件名称： MqttController.java
 * @包 路   径：  cn.org.bjca.szyx.xaas.equipment.controller
 * @版权所有：北京数字医信科技责任有限公司 (C) 2021
 *
 * @类描述:MQTT测试controller
 * @版本: V1.0
 * @创建人： guozhaolong
 * @创建时间：2021-12-02 9:59
 * @修改记录：
 */
@RestController
@RequestMapping("/mqtt")
public class MqttController {

    @Autowired
    private MqttSendClient MqttSendClient;

    /**
     * @author liujianfu
     * @description    测试发布主题
     * @date 2021/8/16 15:04
     * @return RUtils
     */
    @GetMapping(value = "/publishTopic")
    public Object publishTopic(String sendMessage) {
        System.out.println("message:"+sendMessage);
        sendMessage=sendMessage+" : {\"name\":\"ljf\",\"age\":345}";
        MqttSendClient.publish(false,"client:report:2",sendMessage);
        return null;
    }

}
